<template>
    <div class="big-box">
        <div class="header">
            <img src="../../../../../assets/bigScreen/header1.png" alt="" />
            <div class="backBox" @click="goBack"></div>
        </div>
        <div class="backToBox">
            <div class="backTo" @click="gotoHome">
                <div>返回总窗口</div>
            </div>
            <div class="backTo" @click="backToOne">
                <div>返回上一页</div>
            </div>
        </div>
        <div class="centerBox">
            <div class="sreenTitle">{{tabAct==0?'科技研发需求':'科研人才需求'}}</div>
            <div class="center">

                <div class="search_box">
                    <!-- <div class="search_box_top">
				<div class="search_box_top_title"></div>
				<div>
					<a-input-search v-model:value="value" placeholder="请输入关键词" enter-button="搜索企业/老板" @search="onSearch"
						style="width: 50rem" />
				</div>
			</div> -->
                    <div class="search_box_middle">
                        <div class="search_box_middle_item">
                            <div class="search_box_middle_item_name">行业领域</div>
                            <div class="search_box_middle_item_tag">
                                <div :class="fieldIndex==-1?'search_box_middle_item_tagItem active':'search_box_middle_item_tagItem'"
                                    @click="fieldIndex=-1;params.number=1;current=1;getList()">不限</div>
                                <div :class="index==fieldIndex?'search_box_middle_item_tagItem active':'search_box_middle_item_tagItem'"
                                    v-for="(item,index) in orgTypeList" @click="fieldIndex=index;params.number=1;current=1;getList()" :key="index">
                                    {{item.name}}
                                </div>
                            </div>
                            <!-- <div class="search_box_middle_item_more">更多分类<img src="../../../assets/more-icon.png" alt=""></div> -->
                        </div>
                        <div class="search_box_middle_item">
                            <div class="search_box_middle_item_name">服务预算</div>
                            <div class="search_box_middle_item_tag">
                                <div :class="priceIndex==-1?'search_box_middle_item_tagItem active':'search_box_middle_item_tagItem'"
                                    @click="priceIndex=-1;params.number=1;getList()">不限</div>
                                <div :class="index==priceIndex?'search_box_middle_item_tagItem active':'search_box_middle_item_tagItem'"
                                    v-for="(item,index) in priceList" @click="priceIndex=index;params.number=1;getList()" :key="index">
                                    {{item.name}}
                                </div>
                            </div>
                            <div class="search_box_middle_item_more"></div>
                        </div>
                    </div>
                </div>
                <div class="need-box">
                    <div class="need-box-bottom">
                        <div class="need-box-bottom-left">
                            <div class="need-box-bottom-left-item" v-for="(item,index) in commonList" :key="index">
                                <div class="need-item-left">
                                    <div class="need-item-left-name">{{ item.name.length > 18 ? item.name.slice(0, 18) + '...' : item.name }}</div>
                                    <div class="need-item-left-tagBox">
                                        <div class="need-item-left-tag">{{ item.industrySectorName }}</div>
                                        <!-- <div class="need-item-left-tag">新材料技术</div> -->
                                    </div>
                                    <div class="need-item-left-company">
                                        需求方：{{ item.dept ? item.dept.length > 18 ? item.dept.slice(0, 18) + '...' : item.dept : '' }}</div>
                                    <div class="need-item-left-time">发布时间： {{ item.createTime }}</div>
                                </div>
                                <div class="line"></div>
                                <div class="need-item-right">
                                    <div style="font-size: 1.8rem;color: #aeaeae;">预算（万元）</div>
                                    <div style="font-size: 2.4rem;color: #FFEF09;" v-if="tabAct == 0">
                                        {{ item.consultStatus.value == '0' ? item.budgetAmount : '双方协商' }}</div>
                                    <div style="font-size: 2.4rem;color: #FFEF09;" v-else>{{ item.reward }}</div>
                                    <div class="need-item-right-button" @click="toRequirementDetail(item.id)">查看详情</div>
                                </div>
                            </div>
                            <no-data v-if="commonList.length==0" />
                        </div>
                    </div>
                </div>
                <div style="text-align: center;padding: 5rem 0;">
                    <a-pagination v-model:current="current" :total="total" @change="pageChange" :showSizeChanger='false' />
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import noData from "../../../no-data.vue";

import {
    getResearchOrganization,
    getTechField
} from "../../../../../api/scientificResearch.js"
import {
    getDemandTechnologyList,
    getDemandPersonnelList,
    getIndustryFirst,
    getDemandTechnology,
    getDemandPersonnel
} from "../../../../../api/technology.js"
export default {
    components: {
        noData,
    },
    data() {
        return {
            current: 1,
            tabList: ['科研机构', '科研人才'],
            tabAct: 0,
            orgList: [],
            fieldList: [],
            orgTypeList: [],
            fieldIndex: -1,
            priceIndex: -1,
            orgTypeIndex: 0,

            value: '',
            value1: '',
            value2: '',
            value3: '',
            params: {
                number: 1,
                size: 10,
                industrySectorId: undefined,
                budgetAmount: undefined,
                budgetAmountMax: undefined
            },
            commonList: [],
            priceList: [
                {
                    name: '1万以内',
                    min: 0,
                    max: 1
                },
                {
                    name: '1万~3万',
                    min: 1,
                    max: 3
                },
                {
                    name: '3万~5万',
                    min: 3,
                    max: 5
                },
                {
                    name: '5万~10万',
                    min: 5,
                    max: 10
                },
                {
                    name: '10万~30万',
                    min: 10,
                    max: 30
                },
                {
                    name: '30万~50万',
                    min: 30,
                    max: 50
                },
                {
                    name: '50万以上',
                    min: 50,
                    max: null
                }
            ]
        }
    },
    created() {

    },
    mounted() {
        if (this.$route.query.tabAct) {
            this.tabAct = this.$route.query.tabAct;
        }
        console.log(this.tabAct);
            if (this.tabAct == 0) {
                this._getDemandTechnologyList()
            } else {
                this._getDemandPersonnelList()
            }
        this.init();
        // this._getDemandTechnologyList()
        this._getIndustryFirst()
        this.setTabIndex(this.tabAct);
    },
    methods: {
        gotoHome() {
            router.push({
                path: '/bigScreenIndex',
            })
        },
        backToOne() {
            router.go(-1)
        },

        onSearch() {

        },
        changeTab(k) {
            this.tabAct = k;
        },
        changeTabAct(data) {
            this.tabAct = data
            if (data == 0) {
                this._getDemandTechnologyList()
            } else {
                this._getDemandPersonnelList()
            }
            this.setTabIndex(data);
        },
        setTabIndex(index) {
            localStorage.setItem('reqTabAct', index)
        },
        // 获取领域列表
        _getIndustryFirst() {
            getIndustryFirst().then(res => {
                if (res.code == 200) {
                    this.orgTypeList = res.data
                }
            })
        },
        // 获取技术需求列表
        _getDemandTechnologyList() {
            getDemandTechnology(this.params).then(res => {
                if (res.code == 200) {
                    this.total = res.data.total
                    this.commonList = res.data.list
                }
            })
        },
        // 获取人才需求列表
        _getDemandPersonnelList() {
            getDemandPersonnel(this.params).then(res => {
                if (res.code == 200) {
                    this.total = res.data.total
                    this.commonList = res.data.list
                }
            })
        },
        pageChange(e) {
            console.log(e);
            this.current = e
            this.params.number = e
            this.getList()
        },
        getList() {
            if (this.fieldIndex >= 0) {
                this.params.industrySectorId = this.orgTypeList[this.fieldIndex].id
            } else {
                this.params.industrySectorId = ''
            }
            if (this.priceIndex >= 0) {
                this.params.budgetAmount = this.priceList[this.priceIndex].min
                this.params.budgetAmountMax = this.priceList[this.priceIndex].max
            } else {
                this.params.budgetAmount = ''
                this.params.budgetAmountMax = ''
            }
            if (this.tabAct == '0') {
                this._getDemandTechnologyList()
            } else {
                this._getDemandPersonnelList()
            }
        },
        init() {
            // getResearchOrganization().then(res => {
            // 	if (res.code === 200) {
            // 		this.orgList = res.data.list;
            // 		this.orgList.map(v => {
            // 			v.time = v.establishTime.substring(0, 10)
            // 		})
            // 	}
            // })
            // getTechField().then(res => {
            // 	if (res.code === 200) {
            // 		this.fieldList = res.data;
            // 	}
            // })
        },
        toRequirementDetail(id) {
            if (this.tabAct == '0') {
                this.$router.push({
                    path: '/bigScreen/demandDetail',
                    query: {
                        id: id
                    }
                })
            } else {
                this.$router.push({
                    path: '/bigScreen/demandDetail1',
                    query: {
                        id: id
                    }
                })
            }
        },
        gotoHome() {
            this.$router.push({
                path: '/bigScreenIndex',
            })
        },
        backToOne() {
            console.log('11');
            this.$router.go(-1)
        },
        goBack() {
            this.$router.push('/chart')
        }
    }
}
</script>

<style scoped lang="scss">
@font-face {
    font-family: "ffa";
    src: url(../../../assets/bigScreen/fonts/DS-DIGIB.TTF);
}
ul,
li {
    list-style: none;
}
.big-box {
    background-color: #071c3b;
    height: 100vh;
}
.header {
    position: relative;
    text-align: center;
    position: relative;
    height: 19.1rem;

    .backBox {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 70rem;
        height: 10rem;
        cursor: pointer;
    }

    > img {
        width: 100%;
        max-height: 100%;
        margin-top: -1.1rem;
        image-rendering: -moz-crisp-edges; /* Firefox */
        image-rendering: -o-crisp-edges; /* Opera */
        image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming) */
        image-rendering: crisp-edges;
        -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
    }
}
.centerBox {
    width: 96%;
    margin: 0 auto;
    position: absolute;
    top: 14rem;
    left: 2%;
    .sreenTitle {
        background-image: url("../../../../../assets/bigScreen/sreenTitle.png");
        background-size: 100% 100%;
        height: 3.8rem;
        padding-left: 35px;
        font-weight: 600;
        color: #fff;
        display: flex;
        align-items: center;
    }
    .center {
        margin-top: 1rem;
        height: calc(100vh - 20rem);
        border: 1px solid;
        border-image: linear-gradient(
                130deg,
                #2385df 0%,
                rgba(35, 133, 223, 0.65) 92%
            )
            1;
        overflow-y: scroll;
        padding: 20px;
        .need-box {
            width: 140rem;
            margin: 3rem auto 0;

            .need-box-top {
                display: flex;
                justify-content: space-between;

                .need-box-top-left {
                    width: 69rem;
                    height: 8rem;
                    background: url("../../../assets/need-left.png") no-repeat;
                    background-size: 100% 100%;
                    color: #ffffff;
                    text-align: center;
                    font-size: 2rem;
                    padding: 1rem 0;
                    cursor: pointer;
                }

                .need-box-top-right {
                    width: 69rem;
                    height: 8rem;
                    background: url("../../../assets/need-right.png") no-repeat;
                    background-size: 100% 100%;
                    color: #ffffff;
                    text-align: center;
                    font-size: 2rem;
                    padding: 1rem 0;
                    cursor: pointer;
                }
            }

            .need-box-bottom {
                display: flex;
                justify-content: space-between;
                height: 100%;
                margin-top: 2rem;

                .need-box-bottom-left {
                    display: flex;
                    justify-content: space-between;
                    flex-wrap: wrap;
                    width: 140rem;
                    overflow: hidden;

                    .need-box-bottom-left-item {
                        position: relative;
                        display: flex;
                        justify-content: space-between;
                        padding: 2rem 3rem;
                        width: 49%;
                        height: 16.7rem;
                        border-radius: 8px;
                        background: #082853;
                        border: 1px solid #4494FF46;
                        margin-top: 2rem;
                        float: left;
                        // margin-right: 1%;

                        .line {
                            position: absolute;
                            top: 0;
                            right: 15.6rem;
                            width: 1px;
                            height: 100%;
                            background: #4494FF46;
                        }

                        .need-item-left {
                            display: flex;
                            justify-content: space-between;
                            flex-direction: column;

                            .need-item-left-name {
                                font-size: 2.4rem;
                                color: #fff;
                            }

                            .need-item-left-tagBox {
                                display: flex;
                                justify-content: left;

                                .need-item-left-tag {
                                    border-radius: 4px;
                                    background: #037aff;
                                    padding: 0.2rem 0.6rem;
                                    font-size: 1.6rem;
                                    color: #fff;
                                    text-align: center;
                                    margin-right: 1rem;
                                }
                            }

                            .need-item-left-company {
                                font-size: 1.6rem;
                                color: #fff;
                            }

                            .need-item-left-time {
                                font-size: 1.6rem;
                                color: #fff;
                            }
                        }

                        .need-item-right {
                            display: flex;
                            justify-content: space-between;
                            flex-direction: column;

                            .need-item-right-button {
                                width: 9rem;
                                height: 3rem;
                                border-radius: 50px;
                                background: #037aff;
                                border: 1px solid #037aff;
                                font-size: 1.4rem;
                                color: #fff;
                                text-align: center;
                                line-height: 3rem;
                                cursor: pointer;
                            }
                        }
                    }
                }

                .need-box-bottom-right {
                    width: 40rem;
                    height: 52rem;
                    border-radius: 16px;
                    background: rgba(193, 227, 255, 0.36);
                    margin-top: 1rem;

                    .need-bottom-title {
                        font-size: 2.4rem;
                        color: rgba(21, 26, 41, 0.48);
                        text-align: center;
                        margin-top: 4.7rem;
                    }

                    .need-bottom-img {
                        width: 40rem;
                        height: 22rem;
                        margin-top: 5rem;

                        img {
                            width: 100%;
                            height: 100%;
                        }
                    }

                    .need-bottom-button {
                        width: 36rem;
                        height: 6.7rem;
                        border-radius: 8px;
                        background: #037aff;
                        box-shadow: 0px 4px 10px 0px rgba(3, 122, 255, 0.3);
                        color: #ffffff;
                        font-size: 2rem;
                        text-align: center;
                        line-height: 6.7rem;
                        margin: 5rem auto 0;
                    }
                }
            }
        }

        .search_box_middle {
            padding: 2rem 0 0 0;
            position: relative;

            .p-num {
                position: absolute;
                right: 0;
                top: 3.2rem;
                width: 20%;
                height: 17.4rem;
                border-left: 1px solid #4494FF46;
                color: #888888;
                font-size: 1.8rem;
                text-align: center;

                span {
                    font-size: 3.6rem;
                    color: #ce0000;
                    margin-top: 2.8rem;
                }
            }

            .search_box_middle_item {
                display: flex;
                justify-content: left;
                padding-bottom: 3rem;

                .search_box_middle_item_name {
                    width: 8%;
                    font-size: 1.8rem;
                    color: #fff;
                }

                .search_box_middle_item_tag {
                    width: 95%;
                    display: flex;
                    flex-wrap: wrap;
                    // justify-content: space-between;

                    .search_box_middle_item_tagItem {
                        font-size: 1.6rem;
                        color: #fff;
                        cursor: pointer;
                        margin-right: 3rem;
                        margin-bottom: 3rem;
                    }

                    .active {
                        border-radius: 0.4rem;
                        background: #037aff;
                        color: #fff;
                        padding: 0.3rem 1.4rem;
                    }
                }

                .search_box_middle_item_more {
                    width: 10%;
                    font-size: 1.6rem;
                    color: #037aff;
                    text-align: right;
                    display: flex;
                    align-items: center;
                    justify-content: flex-end;
                    cursor: pointer;

                    img {
                        margin-left: 1rem;
                    }
                }
            }
        }

        .search_box_bottom {
            .search_box_bottom_title {
                font-size: 2.4rem;
                color: #037aff;
            }

            .search_box_bottom_content {
                display: flex;
                justify-content: space-between;
                flex-wrap: wrap;
                padding-top: 1.4rem;

                .search_box_bottom_content_item {
                    display: flex;
                    justify-content: left;
                    align-items: center;
                    width: 65rem;
                    height: 16rem;
                    border-radius: 8px;
                    background: linear-gradient(
                        180deg,
                        rgba(245, 248, 252, 0.7) 0%,
                        #ffffff 100%
                    );
                    box-sizing: border-box;
                    border: 0.1rem solid #4494FF46;
                    box-shadow: 8px 8px 20px 0rem rgba(231, 237, 247, 0.51);
                    margin-bottom: 2rem;
                    padding: 2rem;

                    .search_box_bottom_content_item_left {
                        width: 12rem;
                        height: 12rem;
                    }

                    .search_box_bottom_content_item_right {
                        display: flex;
                        justify-content: space-between;
                        flex-direction: column;
                        height: 100%;
                        width: calc(100% - 14rem);
                        margin-left: 2rem;

                        .item_title {
                            font-size: 2rem;
                            color: #232323;
                        }

                        .item_content {
                            font-size: 1.6rem;
                            color: rgba(0, 0, 0, 0.85);
                            text-overflow: -o-ellipsis-lastline;
                            overflow: hidden; //溢出内容隐藏
                            text-overflow: ellipsis; //文本溢出部分用省略号表示
                            display: -webkit-box; //特别显示模式
                            -webkit-line-clamp: 2; //行数
                            line-clamp: 2;
                            -webkit-box-orient: vertical; //盒子中内容竖直排列
                        }

                        .item_info {
                            display: flex;
                            justify-content: space-between;
                            font-size: 1.6rem;
                            color: #555555;

                            .item_info_item {
                                display: flex;
                                // align-items: center;
                            }
                        }
                    }
                }
            }
        }
    }
    ::-webkit-scrollbar {
        width: 5px;
        height: 10px;
    }

    /* 滚动条轨道 */
    ::-webkit-scrollbar-track {
        background-color: #234470;
    }

    /* 滚动条滑块 */
    ::-webkit-scrollbar-thumb {
        background-color: #061c57;
    }

    /* 鼠标悬停在滚动条上的滑块 */
    ::-webkit-scrollbar-thumb:hover {
        background-color: #555;
    }
}
.backToBox {
    position: absolute;
    top: 8rem;
    right: 2%;
    display: flex;
    .backTo {
        background-image: url("../../../../../assets/bigScreen/backTo.png");
        color: #2dccff;
        background-size: 100% 100%;
        width: fit-content;
        padding: 2px 40px 10px 10px;
        font-weight: 600;
        cursor: pointer;
        margin-left: 10px;
        div {
            padding-top: 5px;
        }
    }
}::v-deep {
    .ant-btn-primary {
        border-color: #037AFF;
        background: #037AFF;
    }

    .ant-input {
        background: rgba(68, 148, 255, 0.12);
        border: none;
        color: #FFFFFF;
    }

    .ant-pagination-item {
        background: rgba(8, 26, 48, 0.8);
        border: 1px solid #0B2F5F;
    }

    .ant-pagination-item a {
        color: #FFFFFF;
    }

    .ant-pagination-prev .ant-pagination-item-link,
    .ant-pagination-next .ant-pagination-item-link {
        background: rgba(8, 26, 48, 0.8);
        border: 1px solid #0B2F5F;
        color: #707981;
    }

    .ant-pagination-disabled .ant-pagination-item-link {
        background: rgba(8, 26, 48, 0.8);
        border: 1px solid #0B2F5F;
        color: #707981;
    }

    .ant-pagination-item-active {
        background: #004DFD;
        border-radius: 2px;
        border: none;
    }

    .ant-pagination-jump-prev .ant-pagination-item-container .ant-pagination-item-ellipsis, 
    .ant-pagination-jump-next .ant-pagination-item-container .ant-pagination-item-ellipsis {
        color: #FFFFFF;
    }
    .ant-select-selector{
        background-color: transparent !important;
        background: rgba(8, 26, 48, 0.8) !important;
        border: 1px solid #0B2F5F !important;
        color: #FFFFFF !important;
    }
}
</style>
